Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
async-helpers
Advanced tools
Use async helpers in templates with engines that typically only handle sync helpers. Handlebars and Lodash have been tested.
Use async helpers in templates with engines that typically only handle sync helpers. Handlebars and Lodash have been tested.
Install with npm
$ npm i async-helpers --save
var asyncHelpers = require('async-helpers');
Create a new instance of AsyncHelpers
returns
{Object}: new AsyncHelpers instanceExample
var asyncHelpers = new AsyncHelpers();
Add a helper to the cache.
Params
name
{String}: Name of the helperfn
{Function}: Helper functionreturns
{Object}: Returns this
for chainingExample
asyncHelpers.set('upper', function (str, cb) {
cb(null, str.toUpperCase());
});
Get all helpers or a helper with the given name.
Params
name
{String}: Optionally pass in a name of a helper to get.options
{Object}: Additional options to use.returns
{Function|Object}: Single helper function when name
is provided, otherwise object of all helpersExample
var helpers = asyncHelpers.get();
var wrappedHelpers = helperAync.get({wrap: true});
Wrap a helper with async handling capibilities.
Params
name
{String}: Optionally pass the name of the helper to wrapreturns
{Function|Object}: Single wrapped helper function when name
is provided, otherwise object of all wrapped helpers.Example
var wrappedHelper = asyncHelpers.wrap('upper');
var wrappedHelpers = asyncHelpers.wrap();
Reset all the stashed helpers.
returns
{Object}: Returns this
to enable chainingExample
asyncHelpers.reset();
Resolve a stashed helper by the generated id.
Params
key
{String}: ID generated when from executing a wrapped helper.cb
{Function}: Callback function with the results of executing the async helper.Example
var upper = asyncHelpers.get('upper', {wrap: true});
var id = upper('doowb');
asyncHelpers.resolve(id, function (err, result) {
console.log(result);
//=> DOOWB
});
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Brian Woodward
Copyright © 2015 Brian Woodward Released under the MIT license.
This file was generated by verb-cli on June 05, 2015.
FAQs
Use async helpers in templates with engines that typically only handle sync helpers. Handlebars and Lodash have been tested.
We found that async-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.